<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section A.6.&nbsp; Chapter 6</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
<script type="text/javascript"><!--
google_ad_client = "pub-0203281046321155";
google_alternate_ad_url = "http://www.bookhtml.com/adbrite.htm";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="4867465545";
google_color_border = "FFFFFF";
google_color_link = "0000FF";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "0000FF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-APP-A-SECT-5.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-APP-A-SECT-7.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><TD valign="top"><a name="learnphpmysql-APP-A-SECT-6"></a>
<h3 id="title-IDAVMCXG" class="docSection1Title">A.6. Chapter 6</h3>
<dl class="docList">
<dt><br><p><span class="docPubcolor"><span class="docEmphStrong">Solution to Question 6-1</span></span></p></dt>
<dd><p class="docList">The first element is located in position <tt>0</tt> of the array.</p></dd>

<dt><br><p><span class="docPubcolor"><span class="docEmphStrong">Solution to Question 6-2</span></span></p></dt>
<dd><p class="docList">The <tt>$months</tt> array can be created as follows:</p>
<pre>
&lt;?php
$months[]='January';
$months[]='February';
$months[]='March';
$months[]='April';
$months[]='May';
$months[]='June';
$months[]='July';
$months[]='August';
$months[]='September';
$months[]='October';
$months[]='November';
$months[]='December';
?&gt;
</pre><br>

<p class="docList">The <tt>array()</tt> function is also correct:</p>
<pre>
array('January,'February','March','April','May','June','July','August','September',
'October','November','December');
</pre><BR>

</dd>

<dt><br><p><span class="docPubcolor"><span class="docEmphStrong">Solution to Question 6-3</span></span></P></dt>
<dd><p class="docList">To create the array with the days in each month:</P>
<pre>
&lt;?php
$months= array('January' =&gt; 31,
               'February' =&gt; 28,
               'March' =&gt; 31,
               'April' =&gt; 30,
               'May' =&gt; 31,
               'June' =&gt; 30,
               'July' =&gt; 31,
               'August' =&gt; 31,
               'September' =&gt; 30,
               'October' =&gt; 31,
               'November' =&gt; 30,
               'December' =&gt; 31);
?&gt;
</pre><br>

</dd>

<dt><BR><p><span class="docPubcolor"><span class="docEmphStrong">Solution to Question 6-4</span></span></p></dt>
<dd><p class="docList">To display the <tt>$months</tt> array:</p>
<pre>
&lt;?php
$months= array('January' =&gt; 31,
               'February' =&gt; 28,
               'March' =&gt; 31,
               'April' =&gt; 30,
               'May' =&gt; 31,
               'June' =&gt; 30,
               'July' =&gt; 31,
               'August' =&gt; 31,
               'September' =&gt; 30,
               'October' =&gt; 31,
               'November' =&gt; 30,
               'December' =&gt; 31);
echo var_dump($months);
?&gt;
</pre><BR>

</dd>
</dl>

<a href="11011536.html"><img src="images/pixel.jpg" alt="" width="1" height="1" border="0"></a></TD></TR></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-APP-A-SECT-5.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-APP-A-SECT-7.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
</body></html>
